package com.itheima.request.http;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/demo1")
public class ServletDemo1 extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String method = req.getMethod();
        System.out.println("请求方式"+method);
        String contextPath = req.getContextPath();
        System.out.println("项目路径"+contextPath);
        String requestURI = req.getRequestURI();
        System.out.println("项目路径+资源路径"+requestURI);
        StringBuffer requestURL = req.getRequestURL();
        System.out.println("服务器路径+项目路径+资源路径"+requestURL);
        String queryString = req.getQueryString();
        System.out.println("?后面的参数"+queryString);

    }
}
